package com.literaryfamily.literaryfamily.enumPackage;


import com.literaryfamily.literaryfamily.exceptions.OperationException;

public enum TokenType {
	/**
	 * 此状态为默认值,为临时登录时使用
	 */
	default_status(0, "默认"),
	keep_login(1, "保持登录"),
	lost_password(2, "密码丢失");
	private final String statusName;

	private TokenType(Integer statusNum, String statusName) {
		this.statusName = statusName;
		this.statusNum = statusNum;
	}

	private final Integer statusNum;


	public int getStatusNum() {
		return statusNum;
	}

	public String getStatusName() {
		return statusName;
	}

	public static TokenType getTokenType(Integer statusNum) {
		return switch (statusNum) {
			case 0 -> default_status;
			case 1 -> keep_login;
			case 2 -> lost_password;
			default -> throw new OperationException("不支持的类型: " + statusNum);
		};
	}
}